import React, { Component } from 'react'

import axios from 'axios'

import {AnimalInterface} from '../../types/home.d'

interface Iprops{
    match:any
}

interface Istata{
    target:AnimalInterface
}

export default class Detail extends Component <Iprops,Istata>{
    state = {
        target:{
            "id": 11810,
            "pet_name": "---",
            "pet_age": "---",
            "pet_breed": 1,
            "pet_gender": 2,
            "pet_species": "---",
            "province": "---",
            "city": "---",
            "county": "---",
            "reason": "----",
            "image": "---",
            "is_video": 0,
            "pet_immunity": 1,
            "pet_expelling": 1,
            "pet_sterilization": 1,
            "pet_status": 2,
            "status": 0
          }
    }
    componentDidMount(){
        console.log(this.props.match.params.id)
        axios.get('/api/detail',{data:{id:this.props.match.params.id}}).then(res => {
            console.log(res);
            this.setState({
                target:res.data
            })
        })
    }
    render() {
        let target = this.state.target;
        console.log(this.state.target)
        return (
            <div>
                {target.pet_name}
            </div>
        )
    }
}
